#pragma once
#include <iostream>
#include <sstream>
#include <memory>
#include "number.h"

class Matrix2;
class Vector2D {
 public:
  friend class Matrix2;
  Vector2D();
  Vector2D(ZNumber x, ZNumber y);
  Vector2D(int32_t x, int32_t y);
  Vector2D(const Vector2D& other);
  ~Vector2D();

  const ZNumber& X() const;
  const ZNumber& Y() const;

  void SetX(ZNumber x);
  void SetY(ZNumber y);

  ZNumber Length() const;
  ZNumber LengthSquare() const;

  void Set(ZNumber x, ZNumber y);

  void operator=(const Vector2D& other);

  Vector2D operator-(const Vector2D& other) const;

  Vector2D operator-() const;

  Vector2D operator+(const Vector2D& other) const;

  Vector2D operator*(const ZNumber& other) const;

  Vector2D operator/(const ZNumber& other) const;

  ZNumber operator*(const Vector2D& other) const;
  Vector2D operator*(const Matrix2& other) const;

  bool operator==(const Vector2D& other) const;

  bool operator<=(const Vector2D& other) const;

  bool operator<(const Vector2D& other) const;

  Vector2D Normal() const;

  void SetRealValue(int64_t x, int64_t y);

  std::string ToString() const;

  std::string Print() const;

  void Clear();

  bool IsZero();

  uint32_t GridX() const;
  uint32_t GridY() const;

  ZNumber Dot(const Vector2D& other) const;

 private:
  ZNumber x_;
  ZNumber y_;
};

